package com.ftx.controller.test.annotation.beans;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * Created by fengtingxin on 2020/4/15.
 */
@Component
public class Dog implements ApplicationContextAware {

    private ApplicationContext applicationContext;

    public Dog(){
        System.out.println("Dog 。。。 constructor ...");
    }

    @PostConstruct
    public void init(){
        System.out.println("Dog 。。。 init ...");
    }

    @PreDestroy
    public void destroy(){
        System.out.println("Dog ... destroy ....");
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
}
